<template>
  <div style="padding: 10px" class="user">
    <el-card>
      <el-tabs v-model="activeName" @tab-click="handleClick">
        <!-- <el-divider></el-divider> -->
        <div class="xhxBox"></div>
        <el-form
          style="margin-bottom: 20px"
          :inline="true"
          label-position="left"
          label-width="80px"
          :model="userdata"
          class="demo-form-inline"
        >
        <el-form-item
            label="用户组"
            label-width="55px"
            v-show="this.showTop != '1' && userCode != '用户'"
          >
            <el-select
              v-model="userdata.ugName"
              placeholder="请选择用户组"
              clearable
              filterable
              style="width: 200px; margin-right: 30px"
            >
              <el-option
                v-for="(item, index) in userGroupList"
                :key="index"
                :label="item.label"
                :value="item.value"
                :disabled="item.disabled"
              ></el-option>
            </el-select>
          </el-form-item>
        <el-form-item label="用户账号">
            <el-input
              style="width: 200px; margin-right: 29px"
              maxlength="20"
              clearable
              v-model="userdata.userAccount"
              placeholder="请输入用户账号"
            ></el-input>
          </el-form-item>
          <el-form-item label="用户昵称">
            <el-input
              style="width: 200px; margin-right: 29px"
              v-model.trim="userdata.createBy"
              maxlength="20"
              clearable
              placeholder="请输入用户昵称"
            ></el-input>
          </el-form-item>
          <el-form-item label="手机号码" 
          v-show="this.showTop != '1'"
          label-width="80px">
            <el-input
              maxlength="11"
              v-model="userdata.phonenumber"
              clearable
              placeholder="请输入手机号"
              style="width: 200px; margin-right: 30px"
            ></el-input>
          </el-form-item>
          
          <el-form-item label="状态" label-width="50px">
            <el-select
              v-model="userdata.stateUser"
              placeholder="请选择状态"
              clearable
              filterable
              style="width: 200px; margin-right: 30px"
            >
              <el-option
                v-for="(item, index) in field105Options"
                :key="index"
                :label="item.label"
                :value="item.value"
                style="padding-bottom: 40px; margin-bottom: 5px"
              ></el-option>
            </el-select>
          </el-form-item>
         
          
          
           <el-form-item label="用户姓名">
            <el-input
              style="width: 200px; margin-right: 29px"
              maxlength="10"
              clearable
              v-model="userdata.userName"
              placeholder="请输入用户姓名"
            ></el-input>
          </el-form-item>
          <!-- <el-form-item>
            <el-button
              icon="el-icon-refresh"
              type="primary"
              @click="ResetButton('queryForm')"
              >重置
            </el-button>
            <el-button icon="el-icon-search" type="primary" @click="search"
              >查询
            </el-button>
          </el-form-item> -->
          <div style="display: flex; justify-content: center">
            <el-button
              icon="el-icon-refresh"
              type="primary"
              style="
                background: #eee;
                color: #6c90fb;
                border: 1px solid #e5e7eb;
              "
              @click="ResetButton('queryForm')"
              >重置
            </el-button>
            <el-button icon="el-icon-search" type="primary" @click="search"
              >查询
            </el-button>
            <!-- <el-button icon="el-icon-search" type="primary" @click="ttt"
              >邀请码
            </el-button> -->
          </div>
        </el-form>

        <el-divider></el-divider>
        <el-row style="margin-left:-4px;margin-right: 0;margin-bottom:20px" :gutter="20">
          <!-- <el-col :span="6" v-for="(item, i) in cardData" :key="i">
            <el-card
              class="box-card"
              style="padding: 20px; border-radius: 15px"
            >
              <div style="display: flex; justify-content: space-between">
                <img
                  style="width: 60px; height: 60px; border-radius: 50%"
                  size="large"
                  :src="item.img"
                />
                <div>
                  <div :style="{ color: item.color, 'text-align': 'right' }">
                    <i
                      :class="item.num > 0 ? 'el-icon-top' : 'el-icon-bottom'"
                    ></i
                    >{{ item.num }}
                    %
                  </div>
                  <div style="color: #999; font-size: 16px; margin-top: 6px">
                    比昨日增长
                  </div>
                </div>
              </div>
              <div style="line-height: 40px; color: #545562">{{ item.des }}</div>
              <div style="font-size: 28px">{{ item.num1 || 0 }}</div>
            </el-card>
          </el-col> -->
          <el-col :span="6"  v-for="(item, i) in cardData2" style=" width: 25%;overflow: hidden;">
			        <div style="width: 90%;">
				        <div class="box-card-top" :style="{'--color': item.bgcolor,}">
					        <div style="width: 87px;height: 87px;margin-left:37px">
					          <img :src="item.img" style="width: 87px;height: 87px">
					        </div>
					        <div class="shuju" style="display: flex;flex-direction: column;
						        justify-content: flex-start;margin-left: 15px;
						        height: 87px;
                    width:
						      ">
						        <span style="color:rgb(84 85 98 / 70%)">{{ item.des }}</span>
						        <span style="margin-top: 20px; font-size:  30px;"><font style="font-size:22px" v-if="i==3">￥</font>{{ item.num1 || 0 }}</span>
					        </div>
				        </div>
				        <div class="box-card-bottom"  style="height: 60px;
				            border-radius:0px 0px 20px 20px ;
				            display: flex;flex-direction: row;align-items: center;
				            background-color: rgba(242,241,246,1);">
					          <span style="margin-left: 37px;">比昨日增长</span>
					          <div class="" style="display: flex;flex-direction: row;align-items: center;margin-left: 30px;">
						        <div style="width: 28px;height: 16px;">
                        <img :src="item.img2" style="width: 28px;height: 16px;">
						        </div>
						        <span style="margin-left:20px"><font :style="{ color:item.color, 'text-align': 'right' }">+{{ item.num }}%</font></span>
					      </div>
				        </div>
		        	</div>
		       </el-col>
        
        
        </el-row>
        
        <el-tab-pane label="" name="0" style="">
          <span slot="label">
            <span
              style="
                display: flex;
                align-items: center;
                font-size: 18px;
                margin-top: 0px;
              "
            >
              <img
                src="../../../assets/img/zhi.jpg"
                style="width: 30px; height: 30px"
                v-if="activeName === '0'"
              />
              <img
                src="../../../assets/img/zhi2.jpg"
                style="width: 30px; height: 30px"
                v-else
              />
              直联团队
            </span>
          </span>
          <el-divider ></el-divider>

          <!-- <el-divider></el-divider> -->

          <div
            style="
              display: flex;
              justify-content: space-between;
              margin-bottom: 10px;
            "
          >
            <el-button
              icon="el-icon-user"
              type="primary"
              @click="ifShowTan1(true)"
              >新增用户
            </el-button>
            <div style=" display:flex ;width:120px">
              <el-popover placement="bottom" title="筛选列" trigger="click" width="40" style="display: flex;justify-content: center;align-items: center;">            
	  	          <el-checkbox-group v-model="checkedColumns" size="small">
	  		          <el-checkbox v-for="item in checkBoxGroup" :key="item" :label="item" :value="item">
                  </el-checkbox>
	              </el-checkbox-group>
	  	          <div title="筛选列" class="filter-table-col" slot="reference" >
                  <img src="../../../assets/img/形状 17@2x.png">
                </div>
	            </el-popover>
              <el-button
              style="background: #eeeeee; color: #6396f4; font-weight: bold"
              @click="handleAdd('直联')"
              v-if="userCode != '用户'"
            >
              <img
                src="../../../assets/img/daochu.svg"
                style="
                  width: 15px;
                  height: 15px;
                  margin-right: 5px;
                  margin-bottom: -2px;
                "
              />导出
            </el-button>
            
            </div>
          </div>
          <!-- 租户 直联 -->
          <el-table
          :key="reload"
            v-if="userCode == '租户'"
            :data="tableData1"
            :header-cell-style="{
              background: '#FAFAFA',
              color: 'black',
              'font-size': 15 + 'px',
              'text-align': 'center',
              'height':10+'px'
            }"
          >
            <el-table-column
              fixed
              prop="date"
              label="创建时间"
              align="center"
              v-if="showcolumntable[0].show"
              show-overflow-tooltip
            >
            </el-table-column>
            <el-table-column
              align="center"
              prop="ugName"
              label="用户组"
              v-if="showcolumntable[1].show"
              show-overflow-tooltip
            >
                 <template slot-scope="scope">
                <span>
                  <el-button
                    type="text"
                    @click="editUserGroupBotton(scope.row)"
                    style="height: auto; margin: 0px; padding: 0px;text-decoration:underline"
                    >{{ scope.row.ugName }}</el-button
                  ></span
                >
              </template>
               </el-table-column>
            <el-table-column
              prop="userName"
              label="用户账号"
              v-if="showcolumntable[2].show"

              align="center"
              show-overflow-tooltip
            >
              <template slot-scope="scope">
                <span> {{ scope.row.userName }}</span>
              </template>
            </el-table-column>
            <el-table-column
              prop="nickName"
              label="用户昵称"
              v-if="showcolumntable[3].show"

              align="center"
              show-overflow-tooltip
            >
              <template slot-scope="scope">
                <span>
                  <el-button
                    type="text"
                    @click="CheckSuperior(scope.row)"
                    style="height: auto; margin: 0px; padding: 0px;text-decoration:underline"
                    >{{ scope.row.nickName }}</el-button
                  ></span
                >
              </template>
            </el-table-column>
            <el-table-column prop="phoneNumber" label="手机号" 
              v-if="showcolumntable[4].show"
            align="center">
              <template slot-scope="scope">
                <span> {{ scope.row.phoneNumber }}</span>
              </template>
            </el-table-column>
            <el-table-column
              prop="rmb"
              label="账户余额"
              v-if="showcolumntable[5].show"

              align="center"
              sortable
            >
              <template slot-scope="scope">
                <span style="color: #2678ff">
                  <el-button
                    type="text"
                    @click="moneyBotton(scope.row)"
                    style="height: auto; margin: 0px; padding: 0px"
                  >
                    <span style="display: flex; align-items: center">
                      <span>
                        {{ scope.row.rmb
                        }}<i class="el-icon-edit" style="margin-left: 10px"></i
                      ></span>

                      <!-- <img
                        src="@/assets/img/zhye.png"
                        alt=""
                        style="width: 25px; margin-left: 5px"
                    /> -->
                    </span>
                  </el-button></span
                >
              </template>
            </el-table-column>
            <el-table-column
              prop="templateName"
              label="模版名称"
              v-if="showcolumntable[6].show"

              align="center"
              show-overflow-tooltip
            >
              <template slot-scope="scope">
                <span style="color: #2678ff">
                  <el-button
                    type="text"
                    @click="editTemplateNameBotton(scope.row)"
                    style="height: auto; margin: 0px; padding: 0px"
                  >
                    <span style="display: flex; align-items: center">
                      <span>
                        {{ scope.row.templateName || "暂无"
                        }}<i class="el-icon-edit" style="margin-left: 10px"></i
                      ></span>
                    </span> </el-button
                ></span>
              </template>
            </el-table-column>
            <el-table-column prop="stateUser" label="状态" 
              v-if="showcolumntable[7].show"
            
            align="center">
              <template slot-scope="scope">
                <span v-if="scope.row.stateUser == '0'" style="color: #67c23a"
                  >正常</span
                >
                <span v-if="scope.row.stateUser == '1'" style="color: red"
                  >停用</span
                >
                <span v-if="scope.row.stateUser == '2'" style="color: red"
                  >禁用</span
                >
              </template>
            </el-table-column>
            <!-- <el-table-column
              align="center"
              prop="roleName"
              label="角色组"
              show-overflow-tooltip
            >
              <template slot-scope="scope">
                <span class="blue">{{ scope.row.roleName || "暂无" }}</span>
              </template>
            </el-table-column> -->
            <el-table-column
              prop="state"
              label="是否实名"
              v-if="realNameAuth != 0"
              v-show="showcolumntable[8].show"
              align="center"
            >
              <template slot-scope="scope" 
              >
                <span v-if="scope.row.state == 0" style="color: #2678ff">
                  {{ scope.row.realName }}</span
                >
                 <span v-else style="color: #f00">
                   <el-button
                    type="text"
                    @click="RealName(scope.row)"
                    style="height: auto; margin: 0px;color: #f00; padding: 0px;text-decoration:underline"
                    >未实名</el-button
                  ></span>
              </template>
            </el-table-column>
            <el-table-column
              prop="remark"
              label="备注"
              v-if="showcolumntable[9].show"
              align="center"
              show-overflow-tooltip
            >
              <template slot-scope="scope">
                {{ scope.row.remark || "暂无" }}
              </template>
            </el-table-column>
            <el-table-column fixed="right" label="操作" 
              v-if="showcolumntable[10].show"
            align="center" width="200">
              <template slot-scope="scope">
                <el-button
                  @click="seeMoney(scope.row)"
                  type="text"
                  size="small"
                  v-if="userCode != '用户'"
                  >查看金额
                </el-button>
                <!-- <el-button
                  v-if="realNameAuth != 0 && scope.row.state != 0"
                  @click="RealName(scope.row)"
                  type="text"
                  size="small"
                  >实名
                </el-button> -->
                <el-button
                  type="text"
                  size="small"
                  @click="userGetFun(scope.row)"
                  >编辑</el-button
                >
                <el-button
                  type="text"
                  size="small"
                  @click="editPassword(scope.row)"
                  >更改密码</el-button
                >
              </template>
            </el-table-column>
          </el-table>
          <!-- 用户 直联 -->
          <el-table
            v-if="userCode == '用户'"
            :data="tableData1"
            :header-cell-style="{
              background: '#FAFAFA',
              color: 'black',
              'font-size': 15 + 'px',
              'text-align': 'center',
            }"
          >
            <el-table-column
              fixed
              prop="date"
              label="创建时间"
              align="center"
              v-if="showcolumntable1[0].show"
              show-overflow-tooltip
            >
            </el-table-column>

            <el-table-column
              prop="userName"
              label="用户账号"
               v-if="showcolumntable1[1].show"
              align="center"
              show-overflow-tooltip
            >
            </el-table-column>
            <el-table-column
              prop="nickName"
              label="用户昵称"
              align="center"
               v-if="showcolumntable1[2].show"
              show-overflow-tooltip
            >
              <template slot-scope="scope">
                <span>
                  <el-button
                    type="text"
                    @click="CheckSuperior(scope.row)"
                    style="height: auto; margin: 0px; padding: 0px;text-decoration:underline"
                    >{{ scope.row.nickName }}</el-button
                  ></span
                >
              </template>
            </el-table-column>
            <!-- <el-table-column
              prop="nickName"
              label="用户昵称"
              align="center"
              show-overflow-tooltip
            >
              <template slot-scope="scope">
                <span>{{ scope.row.nickName }}</span>
              </template>
            </el-table-column> -->
            <el-table-column prop="phoneNumber"  v-if="showcolumntable1[3].show" label="手机号" align="center">
              <template slot-scope="scope">
                <span> {{ scope.row.phoneNumber }}</span>
              </template>
            </el-table-column>

            <el-table-column
              prop="rmb"
              label="账户余额"
              align="center"
              sortable
               v-if="showcolumntable1[4].show"
            >
              <template slot-scope="scope">
                <span style="color: #2678ff">{{ scope.row.rmb }}</span>
              </template>
            </el-table-column>

            <el-table-column
              prop="templateName"
              label="模版名称"
              align="center"
              show-overflow-tooltip
               v-if="showcolumntable1[5].show"
            >
              <template slot-scope="scope">
                <el-button
                  type="text"
                  @click="editTemplateNameBotton(scope.row)"
                  style="height: auto; margin: 0px; padding: 0px"
                >
                  <span style="display: flex; align-items: center">
                    <span>
                      {{ scope.row.templateName || "暂无"
                      }}<i class="el-icon-edit" style="margin-left: 10px"></i
                    ></span>
                  </span>
                </el-button>
              </template>
            </el-table-column>
            <el-table-column prop="stateUser"  v-if="showcolumntable1[6].show" label="状态" align="center">
              <template slot-scope="scope">
                <span v-if="scope.row.stateUser == '0'" style="color: #67c23a"
                  >正常</span
                >
                <span v-if="scope.row.stateUser == '1'" style="color: red"
                  >停用</span
                >
                <span v-if="scope.row.stateUser == '2'" style="color: red"
                  >禁用</span
                >
              </template>
            </el-table-column>
            <el-table-column
              prop="state"
              label="是否实名"
              v-if="realNameAuth != 0"
               v-show="showcolumntable1[7].show"
              align="center"
            >
             <template slot-scope="scope"
              >
                <span v-if="scope.row.state == 0" style="color: #2678ff">
                  {{ scope.row.nickName }}</span
                >
                 <span v-else style="color: #f00">
                   <el-button
                    type="text"
                    @click="RealName(scope.row)"
                    style="height: auto; margin: 0px;color: #f00; padding: 0px;text-decoration:underline"
                    >未实名</el-button
                  ></span>
              </template>
            </el-table-column>
            <el-table-column
              prop="remark"
              label="备注"
              align="center"
               v-if="showcolumntable1[8].show"
              show-overflow-tooltip
            >
              <template slot-scope="scope">
                {{ scope.row.remark || "暂无" }}
              </template>
            </el-table-column>
            <el-table-column fixed="right" label="操作"
            v-if="showcolumntable1[9].show" align="center">
              <template slot-scope="scope">
                <el-button
                  @click="seeMoney(scope.row)"
                  type="text"
                  size="small"
                  v-if="userCode != '用户'"
                  >查看金额
                </el-button>
                <!-- <el-button
                  v-if="realNameAuth != 0 && scope.row.state != 0"
                  @click="RealName(scope.row)"
                  type="text"
                  size="small"
                  >实名
                </el-button> -->
                <el-button
                  type="text"
                  size="small"
                  @click="userGetFun(scope.row)"
                  >编辑</el-button
                >
              </template>
            </el-table-column>
          </el-table>
        </el-tab-pane>
        <el-tab-pane label="间联团队" name="1">
          <span slot="label">
            <span style="display: flex; align-items: center; font-size: 18px">
              <img
                src="../../../assets/img/jian.jpg"
                style="width: 30px; height: 30px"
                v-if="activeName === '1'"
              />
              <img
                src="../../../assets/img/jian2.jpg"
                style="width: 30px; height: 30px"
                v-else
              />
              间联团队
            </span>
          </span>
          <el-divider></el-divider>

          <el-divider></el-divider>
          <div
            style="
              display: flex;
              justify-content: flex-end;
              margin-bottom: 10px;
            "
            v-if="userCode != '用户'"
          >
            <el-popover placement="bottom" title="筛选列" trigger="click" width="40" style="display: flex;justify-content: center;align-items: center;">            
	  	          <el-checkbox-group v-model="checkedColumns" size="small">
	  		          <el-checkbox v-for="item in checkBoxGroup" :key="item" :label="item" :value="item">
                  </el-checkbox>
	              </el-checkbox-group>
	  	          <div title="筛选列" class="filter-table-col" slot="reference" >
                  <img src="../../../assets/img/形状 17@2x.png">
                </div>
	            </el-popover>
            <el-button
              style="background: #eeeeee; color: #6396f4; font-weight: bold"
              @click="handleAdd('间联')"
            >
              <img
                src="../../../assets/img/daochu.svg"
                style="
                  width: 15px;
                  height: 15px;
                  margin-right: 5px;
                  margin-bottom: -2px;
                "
              />导出
            </el-button>
          </div>

          <div
            style="
              display: flex;
              justify-content: flex-end;
              margin-bottom: 10px;
              height: 32px;
            "
            v-if="userCode  == '用户'"
            
          >
          <el-popover placement="bottom" title="筛选列" trigger="click" width="40" style="display: flex;justify-content: center;align-items: center;">            
	  	          <el-checkbox-group v-model="checkedColumns" size="small">
	  		          <el-checkbox v-for="item in checkBoxGroup" :key="item" :label="item" :value="item">
                  </el-checkbox>
	              </el-checkbox-group>
	  	          <div title="筛选列" class="filter-table-col" slot="reference" >
                  <img src="../../../assets/img/形状 17@2x.png">
                </div>
	            </el-popover>
              <div style="width:98px">

              </div>
          </div>
          <!-- 租户 间联 -->
          <el-table
            :data="tableData1"
            v-if="userCode!='用户'"
            :header-cell-style="{
             background: '#FAFAFA',
              color: 'black',
              'font-size': 15 + 'px',
              'text-align': 'center',
            }"
          >
            <el-table-column
              fixed
              prop="date"
              label="创建时间"
              v-if="jianliantable[0].show"
              align="center"
            />

            <el-table-column align="center" prop="userName" 
              v-if="jianliantable[1].show"
            
            label="用户账号" />

            <el-table-column prop="nickName" label="用户昵称"
              v-if="jianliantable[2].show"
             align="center">
              <template slot-scope="scope">
                <span>
                  <el-button
                    type="text"
                    @click="CheckSuperior(scope.row)"
                    style="height: auto; margin: 0px; padding: 0px;text-decoration:underline"
                    >{{ scope.row.nickName }}</el-button
                  ></span
                >
              </template>
            </el-table-column>
<!-- v-if="" -->
            <el-table-column prop="phoneNumber" 
              
            label="手机号" align="center" v-if="jianliantable[3].show">
              <template slot-scope="scope">
                <span>
                  {{ scope.row.phoneNumber }}</span
                >
              </template>
            </el-table-column>

            <el-table-column
              prop="rmb"
              label="账户余额"
              align="center"
              sortable
              v-if="jianliantable[4].show"
            >
              <template slot-scope="scope">
                <span style="color: #2678ff">
                  <el-button type="text" @click="moneyBotton(scope.row)">
                    <span style="display: flex; align-items: center">
                      <span>
                        {{ scope.row.rmb || 0
                        }}<i class="el-icon-edit" style="margin-left: 10px"></i
                      ></span>
                      <!-- <img
                        src="@/assets/img/zhye.png"
                        alt=""
                        style="height: 25px; margin-left: 10px;" /> -->
                    </span>
                  </el-button>
                </span>
              </template>
            </el-table-column>

            <el-table-column prop="status" label="状态" v-if="jianliantable[5].show" align="center">
              <template slot-scope="scope">
                <span v-if="scope.row.stateUser == 0" style="color: #2678ff"
                  >正常</span
                >
                <span v-if="scope.row.stateUser == 1" style="color: red"
                  >停用</span
                >
                <span v-if="scope.row.stateUser == 2" style="color: red"
                  >禁用</span
                >
              </template>
            </el-table-column>

            <el-table-column
              prop="state"
              label="是否实名"
              v-if="realNameAuth != 0"
               v-show="jianliantable[6].show"
              align="center"
            >
             <template slot-scope="scope" >
                <span v-if="scope.row.state == 0" style="color: #2678ff">
                  {{ scope.row.nickName }}</span
                >
                 <span v-else style="color: #f00">
                   <el-button
                    type="text"
                    @click="RealName(scope.row)"
                    style="height: auto; margin: 0px; color: #f00;padding: 0px;text-decoration:underline"
                    >未实名</el-button
                  ></span>
              </template>


             
            </el-table-column>

            <el-table-column fixed="right" label="操作" align="center" width="200" v-if="jianliantable[7].show">
              <template slot-scope="scope">
                <el-button
                  @click="seeMoney(scope.row)"
                  type="text"
                  size="small"
                  >查看金额
                </el-button>
                <!-- 改为点击用户昵称就能弹出查看上级 -->
                <!-- <el-button
                  @click="CheckSuperior(scope.row)"
                  type="text"
                  size="small"
                  >查看上级
                </el-button> -->
                <el-button
                  @click="InterEdit(scope.row)"
                  type="text"
                  size="small"
                  >查看
                </el-button>
                 <el-button
                   v-if="userCode != '用户'"
                  type="text"
                  size="small"
                  @click="editPassword(scope.row)"
                  >更改密码</el-button
                >
                <!-- <el-button
                  v-if="realNameAuth != 0 && scope.row.state != 0"
                  @click="RealName(scope.row)"
                  type="text"
                  size="small"
                  >实名
                </el-button> -->
              </template>
            </el-table-column>
          </el-table>
          <!-- 用户 间联 -->
          <el-table
            :data="tableData1"
            v-if="userCode=='用户'"
            :header-cell-style="{
             background: '#FAFAFA',
              color: 'black',
              'font-size': 15 + 'px',
              'text-align': 'center',
            }"
          >
            <el-table-column
              fixed
              prop="date"
              label="创建时间"
              v-if="jianliantable1[0].show"
              align="center"
            />

            <el-table-column align="center" prop="userName" 
              v-if="jianliantable1[1].show"
            
            label="用户账号" />

            <el-table-column prop="nickName" label="用户昵称"
              v-if="jianliantable1[2].show"
             align="center">
              <template slot-scope="scope">
                <span>
                  <el-button
                    type="text"
                    @click="CheckSuperior(scope.row)"
                    style="height: auto; margin: 0px; padding: 0px;text-decoration:underline"
                    >{{ scope.row.nickName }}</el-button
                  ></span
                >
              </template>
            </el-table-column>
            <el-table-column prop="status" label="状态" v-if="jianliantable1[3].show" align="center">
              <template slot-scope="scope">
                <span v-if="scope.row.stateUser == 0" style="color: #2678ff"
                  >正常</span
                >
                <span v-if="scope.row.stateUser == 1" style="color: red"
                  >停用</span
                >
                <span v-if="scope.row.stateUser == 2" style="color: red"
                  >禁用</span
                >
              </template>
            </el-table-column>
          </el-table>

        </el-tab-pane>
        <!-- 分页插件 -->
        <pagination
          :total="total"
          :page.sync="queryParams.pageNum"
          :limit.sync="queryParams.pageSize"
          @pagination="getData"
          style="margin-bottom: 50px"
        />
      </el-tabs>
    </el-card>

    <!-- 新增用户 弹窗-->
    <el-dialog title="新增" :visible.sync="showTan1" width="30%" center>
      <el-form
        ref="TanForm1"
        :model="TanForm1"
        label-width="100px"
        label-position="left"
        :rules="rulesTan1"
      >
        <el-form-item label="用户账号" prop="nickName">
          <el-input
            v-model="TanForm1.nickName"
            placeholder="请输入用户账号"
            maxlength="20"
          ></el-input>
        </el-form-item>

        <el-form-item label="用户昵称" prop="userName">
          <el-input
            v-model="TanForm1.userName"
            placeholder="请输入用户昵称"
            maxlength="20"
          ></el-input>
        </el-form-item>
        <el-form-item label="手机号" prop="phonenumber">
          <el-input
            v-model.number="TanForm1.phonenumber"
            maxlength="11"
            placeholder="请输入手机号"
          ></el-input>
        </el-form-item>

        <el-form-item label="用户组" prop="userGroup" v-if="userCode != '用户'">
          <el-select
            v-model="TanForm1.userGroup"
            placeholder="请选择用户组"
            clearable
            filterable
            :style="{ width: '100%' }"
          >
            <el-option
              v-for="(item, index) in field101Options"
              :key="index"
              :label="item.label"
              :value="item.value"
              :disabled="item.disabled"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="角色组" prop="roleIds" v-if="!userCode == '平台'">
          <el-select
            filterable
            v-model="TanForm1.roleIds"
            placeholder="请选择角色组"
            clearable
            :style="{ width: '100%' }"
          >
            <el-option
              v-for="(item, index) in RoleData"
              :key="index"
              :label="item.roleName"
              :value="item.roleId"
              :disabled="item.disabled"
            ></el-option>
          </el-select>
        </el-form-item>

        <el-form-item label="状态" prop="stateUser" v-if="userCode != '用户'">
          <el-select
            v-model="TanForm1.stateUser"
            placeholder="请选择类型"
            clearable
            filterable
            :style="{ width: '100%' }"
          >
            <el-option
              v-for="(item, index) in field101Optionsstate"
              :key="index"
              :label="item.label"
              :value="item.value"
              :disabled="item.disabled"
            ></el-option>
          </el-select>
        </el-form-item>
        <!-- <el-form-item label="佣金模板">
            <el-select
              v-model="TanForm1.commission"
              placeholder="请选择佣金模板"
              clearable
              :style="{ width: '100%' }"
            >
              <el-option
                v-for="(item, index) in commissionOptions"
                :key="index"
                :label="item.templateName"
                :value="item.id"
                  style="margin-bottom:20px"
              ></el-option>
            </el-select>
          </el-form-item> -->

        <el-form-item label="备注" v-if="userCode != '用户'">
          <el-input
            v-model="TanForm1.remarks"
            placeholder="请输入备注"
            maxlength="150"
            clearable
            autosize
            type="textarea"
          ></el-input>
        </el-form-item>
      </el-form>

      <div slot="footer" class="dialog-footer">
        <el-button size="small" @click="ifShowTan1(false)">取消</el-button>
        <el-button size="small" :disabled='addButtonShow' type="primary" @click="addUserFuns('TanForm1')"
          >确定</el-button
        >
      </div>
    </el-dialog>

    <!-- 更换模板 弹窗-->
    <div v-if="showTan2" class="addTan">
      <section @click="ifShowTan2(false)"></section>
      <div class="tan tan2">
        <p>
          <span>更换模板</span>
          <el-button
            icon="el-icon-circle-close"
            circle
            @click="ifShowTan2(false)"
          ></el-button>
        </p>
        <div>
          <el-form ref="TanForm2" :model="TanForm2" label-width="80px">
            <el-form-item label="更换模板">
              <el-select v-model="TanForm2.data" placeholder="请选择模板">
                <el-option label="模板A" value="A"></el-option>
                <el-option label="模板B" value="B"></el-option>
              </el-select>
            </el-form-item>
          </el-form>
          <p class="but">
            <el-button round>取消</el-button>
            <el-button type="primary" round>确认</el-button>
          </p>
        </div>
      </div>
    </div>

    <!-- 直联修改 弹窗 -->
    <el-dialog
      title="直联编辑"
      :visible.sync="inheritAttrs"
      width="40%"
      @click="onClose"
      center
    >
      <el-row :gutter="15">
        <el-form
          ref="DirectEditing"
          :model="DirectEditing"
          :rules="rulesTan5"
          size="medium"
          label-width="100px"
          hide-required-asterisk
        >
          <el-row>
            <el-col :span="12">
              <el-form-item label="创建时间" class="jsName">
                  <span style="color:#666;margin-left:20px"> {{ DirectEditing.field101 }}</span>
              </el-form-item>
            </el-col>

            <el-col :span="12">
              <el-form-item label="姓名" class="jsName">
                   <span style="color:#666;margin-left:20px"> {{ DirectEditing.field102 }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="余额" class="jsName">
                  <span style="color:#666;margin-left:20px"> {{ DirectEditing.field104 }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="12">
                <el-form-item label="身份证号" class="jsName">
                 <span style="color:#666;margin-left:20px"> {{ DirectEditing.field103 }}</span>
              </el-form-item>
             
            </el-col>
            <el-col :span="12">
              <el-form-item label="用户账号" class="jsName">
                 <span style="color:#666;margin-left:20px"> {{ DirectEditing.field113 }}</span>
              </el-form-item>
            </el-col>
          </el-row>
           <el-row>
          <el-col :span="12">
            <el-form-item label="联系方式" prop="field105">
              <el-input
                :disabled="userCode == '用户'"
                v-model.trim="DirectEditing.field105"
                placeholder="请输入联系方式"
                :maxlength="11"
                show-word-limit
                clearable
               
                :style="{ width: '100%' }"
              ></el-input>
            </el-form-item>
          </el-col>

          <el-col :span="12" v-if="userCode != '用户'">
            <el-form-item label="账号状态" prop="field106">
              <el-select
                v-model="DirectEditing.field106"
                placeholder="请输入账号状态"
                clearable
                filterable
                :style="{ width: '100%' }"
              >
                <el-option
                  v-for="(item, index) in field106Options"
                  :key="index"
                  :label="item.label"
                  :value="item.value"
                  :disabled="item.disabled"
                  style="margin: -4px 0px 15px 0px"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
           <!-- <el-col :span="12">
            <el-form-item label="用户组" prop="field109">
              <el-select
                v-model="DirectEditing.field109"
                placeholder="请选择用户组"
                clearable
                filterable
                :style="{ width: '100%' }"
              >
                <el-option
                  v-for="(item, index) in field101Options"
                  :key="index"
                  :label="item.label"
                  :value="item.value"
                  :disabled="item.disabled"
                  style="margin: -4px 0px 15px 0px"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col> -->
          <el-col :span="12">
            <el-form-item label="用户昵称" prop="field107">
              <el-input
                v-model.trim="DirectEditing.field107"
                placeholder="请输入用户昵称"
                clearable
                maxlength="20"
                show-word-limit
                :style="{ width: '100%' }"
              ></el-input>
            </el-form-item>
          </el-col>

         

          <el-col :span="12">
            <el-form-item label="佣金模板" prop="field110">
              <el-select
                v-model="DirectEditing.field110"
                placeholder="请选择佣金模板"
                clearable
                filterable
                @change="commissionChange"
                :style="{ width: '100%' }"
              >
                <el-option
                  v-for="(item, index) in commissionOptions"
                  :key="index"
                  :label="item.templateName"
                  :value="item.id"
                  style="margin: -4px 0px 15px 0px"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="备注" prop="field112">
              <el-input
                v-model.trim="DirectEditing.field112"
                placeholder="请输入备注"
                clearable
                type="textarea"
                maxlength="150"
                show-word-limit
                :style="{ width: '100%' }"
              ></el-input>
            </el-form-item>
          </el-col>
           </el-row>
        </el-form>
      </el-row>
      <div slot="footer">
        <el-button @click="inheritAttrs = false">取消</el-button>
        <el-button type="primary" @click="Editbutton('DirectEditing')"
          >确定</el-button
        >
      </div>
    </el-dialog>

    <!-- 间联修改 弹窗 -->
    <el-dialog
      title="间联编辑"
      :visible.sync="IndirectShow"
      width="35%"
      @click="onClose"
      center
    >
      <el-row :gutter="15">
        <el-form
          :rules="rulesTan5"
          ref="formData"
          :model="formData"
          size="medium"
          label-width="100px"
          hide-required-asterisk
        >
          <el-row>
            <el-col :span="12">
              <el-form-item label="创建时间" class="jsName">
                <span style="color:#666;margin-left:20px"> {{ formData.field101 }}</span>
              </el-form-item>
            </el-col>

            <el-col :span="12">
              <el-form-item label="姓名" class="jsName">
                 <span style="color:#666;margin-left:20px"> {{ formData.field102 }}</span>
              </el-form-item>
            </el-col>
           
            <el-col :span="12">
              <el-form-item label="余额" class="jsName">
                 <span style="color:#666;margin-left:20px"> {{ formData.field104 }}</span>
              </el-form-item>
            </el-col>
             <el-col :span="12">
              <el-form-item label="身份证号" class="jsName">
                 <span style="color:#666;margin-left:20px"> {{ formData.field103 }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="用户账号" class="jsName">
                 <span style="color:#666;margin-left:20px"> {{ formData.field113 }}</span>
              </el-form-item>
            </el-col>
          </el-row>
           <el-row>
          <el-col :span="12">
            <el-form-item label="联系方式" prop="field105">
              <el-input
                :disabled="userCode == '用户'"
                v-model="formData.field105"
                placeholder="请输入联系方式"
                :maxlength="11"
                show-word-limit
                clearable
                :style="{ width: '100%' }"
              ></el-input>
            </el-form-item>
          </el-col>

          <el-col :span="12" v-if="userCode != '用户'">
            <el-form-item label="账号状态" prop="field106">
              <el-select
                v-model="formData.field106"
                placeholder="请输入账号状态"
                clearable
                filterable
                :style="{ width: '100%' }"
              >
                <el-option
                  v-for="(item, index) in field106Options"
                  :key="index"
                  :label="item.label"
                  :value="item.value"
                  :disabled="item.disabled"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="用户昵称" prop="field107">
              <el-input
                disabled
                v-model="formData.field107"
                placeholder="请输入用户昵称"
                clearable
                maxlength="20"
                :style="{ width: '100%' }"
              ></el-input>
            </el-form-item>
          </el-col>
           </el-row>
        </el-form>
      </el-row>
      <div slot="footer">
        <el-button @click="IndirectShow = false">取消</el-button>
        <el-button type="primary" @click="InterEditButton('formData')"
          >确定</el-button
        >
      </div>
    </el-dialog>

    <!-- 查看金额 弹窗 -->
    <el-dialog title="查看金额" width="50%" :visible.sync="GetMoneyUps" @click="onClose" center>
      <div>
        <el-table :data="roleList" height="450">
          <el-table-column label="变动时间" prop="createTime" align="center" />
          <el-table-column label="变动金额" prop="amount" align="center">
            <template slot-scope="scope">
              <span>
                <span v-show="scope.row.amountType == 'plus'" style="color: red"
                  >+{{ scope.row.amount || "暂无" }}</span
                >
                <span
                  v-show="scope.row.amountType == 'reduce'"
                  style="color: Green"
                  >{{ scope.row.amount || "暂无" }}</span
                >
              </span>
              <!-- reduce -->
            </template>
          </el-table-column>
          <el-table-column label="余额" prop="balance" align="center">
            <template slot-scope="scope">
              <span>
                {{ scope.row.balance || "暂无" }}
                <!-- <span
                  v-show="scope.row.balanceType == 'plus'"
                  style="color: red"
                  >+{{ scope.row.balance || "暂无" }}</span
                >
                <span
                  v-show="scope.row.balanceType == 'reduce'"
                  style="color: Green"
                  >{{ scope.row.balance || "暂无" }}</span
                > -->
              </span>
            </template>
          </el-table-column>
          <el-table-column label="类型" prop="capitalType" align="center">
            <template slot-scope="scope">
                <span>{{scope.row.notes}}</span>
              <!-- <span v-show="scope.row.capitalType == 'OTHER'">其它</span>
              <span v-show="scope.row.capitalType == 'PROFIT'">分润</span>
              <span v-show="scope.row.capitalType == 'COMMISSION'">佣金</span>
              <span v-show="scope.row.capitalType == 'WITHDRAWAL'">提现</span> -->
            </template>
          </el-table-column>
        </el-table>
      </div>

      <pagination
        style="margin: 0px 0px 50px 0px"
        :total="GetMoneyData.total"
        :page.sync="GetMoneyData.pageNum"
        :limit.sync="GetMoneyData.pageSize"
        @pagination="GetMoneyList"
      />
      <div slot="footer">
        <!-- <el-button @click="SuperiorShow = false">取消</el-button> -->
        <!-- <el-button type="primary" @click="handelConfirm">确定</el-button> -->
      </div>
    </el-dialog>
    <!-- 实名弹窗 -->
    <el-dialog title="实名" :visible.sync="tanShow1" width="30%" center>
      <el-form
        ref="elForm"
        :model="formData5"
        :rules="rules5"
        size="medium"
        label-width="100px"
         label-position="left"
      >
        <el-form-item label="真实姓名" prop="field101">
          <el-input
            v-model="formData5.field101"
            placeholder="请输入真实姓名"
            clearable
            onkeyup="this.value=this.value.replace(/[, ]/g,'')"
            maxlength="10"
            :style="{ width: '100%' }"
          >
          </el-input>
        </el-form-item>
        <el-form-item label="身份证号" prop="field102">
          <el-input
            v-model="formData5.field102"
            placeholder="请输入身份证号"
            clearable
            maxlength="18"
            :style="{ width: '100%' }"
          >
          </el-input>
        </el-form-item>
      </el-form>
      <div slot="footer">
        <el-button @click="tanShow1 = false">取消</el-button>
        <el-button type="primary" @click="handelConfirm5">确定</el-button>
      </div>
    </el-dialog>
       <!-- 更改密码弹窗 -->
    <el-dialog title="更改密码" :visible.sync="passwordShow" width="30%" center>
      <el-form
        ref="passwordDataElForm"
        :model="passwordData"
        :rules="passwordDataRules"
        size="medium"
        label-width="100px"
         label-position="left"
      >
        <el-form-item label="新密码" prop="field101">
          <el-input
            v-model="passwordData.field101"
            placeholder="请输入新密码"
            clearable
            onkeyup="this.value=this.value.replace(/[, ]/g,'')"
            maxlength="10"
            :style="{ width: '100%' }"
          >
          </el-input>
        </el-form-item>
        <el-form-item label="确认密码" prop="field102">
          <el-input
            v-model="passwordData.field102"
            placeholder="请输入确认密码"
            clearable
            onkeyup="this.value=this.value.replace(/[, ]/g,'')"
            maxlength="10"
            :style="{ width: '100%' }"
          >
          </el-input>
        </el-form-item>
      </el-form>
      <div slot="footer">
        <el-button @click="passwordShow = false">取消</el-button>
        <el-button type="primary" @click="editPasswordButton">确定</el-button>
      </div>
    </el-dialog>
    <!-- 充值和扣款弹窗 -->
    <el-dialog title="操作金额" :visible.sync="moneyShow" width="30%" center>
      <el-form
        ref="elForm"
        :model="moneyData"
        :rules="moneyrules"
        size="medium"
        label-width="100px"
         label-position="left"
      >
        <el-form-item label="选择" prop="field101">
          <el-radio v-model="moneyData.field101" label="3">充值</el-radio>
          <el-radio v-model="moneyData.field101" label="2">扣款</el-radio>
        </el-form-item>
        <el-form-item label="当前余额">
          <el-input
            v-model="moneyData.field102"
            readonly
            clearable
            :style="{ width: '100%' }"
            v-bind:disabled="true"
          ></el-input>
        </el-form-item>
        <el-form-item label="金额" prop="field103">
          <el-input
            v-model="moneyData.field103"
            placeholder="请输入金额"
            maxlength="7"
            onkeyup="this.value=this.value.replace(/[, ]/g,'')"
            clearable
            :style="{ width: '100%' }"
          >
          </el-input>
        </el-form-item>
        <el-form-item label="备注">
          <el-input
            v-model="moneyData.field104"
            type="textarea"
            maxlength="200"
            placeholder="请输入备注"
            autosize
            :style="{ width: '100%' }"
          ></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer">
        <el-button @click="moneyShow = false">取消</el-button>
        <el-button type="primary" @click="moneyShowButton">确定</el-button>
      </div>
    </el-dialog>
    <!-- 修改模版名称弹窗 -->
    <el-dialog
      title="编辑"
      :visible.sync="editTemplateNameShow"
      width="30%"
      center
    >
      <el-form
        ref="editTemplateNameElForm"
        :model="DirectEditing"
        :rules="editTemplateNameRules"
        size="medium"
        label-width="100px"
         label-position="left"
      >
        <el-form-item label="佣金模板" prop="field110">
          <el-select
            v-model="DirectEditing.field110"
            placeholder="请选择佣金模板"
            clearable
            filterable
            :style="{ width: '100%' }"
          >
            <el-option
              v-for="(item, index) in commissionOptions"
              :key="index"
              :label="item.templateName"
              :value="item.id"
              style="margin: -4px 0px 15px 0px"
            ></el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <div slot="footer">
        <el-button @click="editTemplateNameShow = false">取消</el-button>
        <el-button
          type="primary"
          @click="EditTemplateNamebutton('editTemplateNameElForm')"
          >确定</el-button
        >
      </div>
    </el-dialog>
      <!-- 修改用户组弹窗 -->
    <el-dialog
      title="用户组编辑"
      :visible.sync="editUserGroupShow"
      width="30%"
      center
    >
      <el-form
        ref="EditUserGroupbuttonElForm"
        :model="userGroupData"
        :rules="userGroupDataRules"
        size="medium"
        label-width="100px"
         label-position="left"
      >
        <el-form-item label="用户组" prop="field101">
          <el-select
            v-model="userGroupData.field101"
            placeholder="请选择用户组"
            clearable
            filterable
            :style="{ width: '100%' }"
          >
            <el-option
              v-for="(item, index) in editUserGroupData"
              :key="index"
                  :label="item.ugName"
                  :value="item.ugId"
                  :disabled="item.disabled"
              style="margin: -4px 0px 15px 0px"
            ></el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <div slot="footer">
        <el-button @click="editUserGroupShow = false">取消</el-button>
        <el-button
          type="primary"
          @click="EditUserGroupbutton('EditUserGroupbuttonElForm')"
          >确定</el-button
        >
      </div>
    </el-dialog>

    <!-- 公告弹窗 -->
    <Dialog
      ref="mychild"
      @AddAnnouncement="AddAnnouncement"
      :uelLocation="uelLocation"
    />
    <!-- 查看上级 -->
    <ViewSuperior ref="superior" :IdData="IdData" />
  </div>
</template>
<script>
import Dialog from "@/views/components/Dialog.vue";
import ViewSuperior from "@/views/components/ViewSuperior.vue";
import {
  selectByTeamSum,
  addUser,
  selectByTeamUser,
  selectByUserGroupList,
  selectByBetweenTeamUser,
  updateUserAPI,
  selectByHierarchy,
  updateRUser,
  selectCapUserWalletList,
  getCommission,
  getCommissionjudge,
  addMoney,
  getMoney,
  modifyMoney,
  selectCapUserWalletRecordList,
  addUserWallet,
  reduceUserWallet,
  totalIncome,
  userAdd,
  exportStraightTeamUser,
  exportBetweenTeamUser,resetPassword
} from "@/api/base/index.js";
import { listRole } from "@/api/selfcom/role";
import {
  getSetup,
  selectTotalRevenue,
  selectByInvitationCodeIsUserId,
} from "@/api/system/index";
import { getIdentityAndTopId, getAliDy } from "@/api/login.js";
export default {
  data() {
    return {
      reload:'',
        checkedColumns:[],
        checkBoxGroup:[],
        // 租户直联
        zzcheckedColumns: ["创建时间",	"用户组","用户账号","用户昵称", "手机号", "账户余额","模板名称","状态","是否实名","备注","操作",],
        zzcheckBoxGroup: ["创建时间",	"用户组","用户账号","用户昵称", "手机号", "账户余额","模板名称","状态","是否实名","备注","操作",],
        // 租户间联
        zjcheckedColumns: ["创建时间","用户账号","用户昵称", "手机号", "账户余额","状态","是否实名","操作",],
        zjcheckBoxGroup: ["创建时间","用户账号","用户昵称", "手机号", "账户余额","状态","是否实名","操作",],
        // 用户直联
        yzcheckedColumns: ["创建时间","用户账号","用户昵称", "手机号", "账户余额","模板名称","状态","备注","操作",],
        yzcheckBoxGroup: ["创建时间","用户账号","用户昵称", "手机号", "账户余额","模板名称","状态","备注","操作",],

        // 用户间联
        yjcheckedColumns: ["创建时间","用户账号","用户昵称","状态"],
        yjcheckBoxGroup: ["创建时间","用户账号","用户昵称","状态"],

        showcolumntable:[
          {
            id:0,
            show:true,
            name:"创建时间"
          },
          {
            id:1,
            show:true,
            name:"用户组"
          }
          ,
          {
            id:2,
            
            show:true,
            name:"用户账号"
          }
          ,
          {
            id:3,
            show:true,
            name:"用户昵称"
          }
          ,
          {
            id:4,
            show:true,
            name:"手机号"
          }
          ,
          {
            id:5,
            show:true,
            name:"账户余额"
          }
          ,
          {id:6,
            show:true,
            name:"模板名称"
          }
          ,
          {id:7,
            show:true,
            name:"状态"
          }
          ,
          {id:8,
            show:true,
            name:"是否实名"
          }
          ,
          {
            id:9,
            show:true,
            name:"备注"
          }
          ,
          {
            id:10,
            show:true,
            name:"操作"
          }
        ],

        showcolumntable1:[
          {
            id:0,
            show:true,
            name:"创建时间"
          },
          {
            id:1,
            
            show:true,
            name:"用户账号"
          }
          ,
          {
            id:2,
            show:true,
            name:"用户昵称"
          }
          ,
          {
            id:3,
            show:true,
            name:"手机号"
          }
          ,
          {
            id:4,
            show:true,
            name:"账户余额"
          }
          ,
          {id:5,
            show:true,
            name:"模板名称"
          }
          ,
          {id:6,
            show:true,
            name:"状态"
          }
          ,
          {id:7,
            show:true,
            name:"是否实名"
          }
          ,
          {
            id:8,
            show:true,
            name:"备注"
          }
          ,
          {
            id:9,
            show:true,
            name:"操作"
          }
        ],

        jianliantable:[
          {
            id:0,
            show:true,
            name:"创建时间"
          },
          {
            id:1,
            
            show:true,
            name:"用户账号"
          }
          ,
          {
            id:2,
            show:true,
            name:"用户昵称"
          }
          ,
          {
            id:3,
            show:true,
            name:"手机号"
          }
          ,
          {
            id:4,
            show:true,
            name:"账户余额"
          }
          ,
          {id:5,
            show:true,
            name:"状态"
          }
          ,
          {id:6,
            show:true,
            name:"是否实名"
          }
          ,
          {
            id:7,
            show:true,
            name:"操作"
          }
        ],
        jianliantable1:[
          {
            id:0,
            show:true,
            name:"创建时间"
          },
          {
            id:1,
            
            show:true,
            name:"用户账号"
          }
          ,
          {
            id:2,
            show:true,
            name:"用户昵称"
          },
          {id:3,
            show:true,
            name:"状态"
          }
        ],
      //用户组编辑下拉框参数
      editUserGroupData:[],
      //用户组编辑参数
      userGroupData:{
        field101:"",
      },
       userGroupDataRules: {
        field101: [
          {
            required: true,
            message: "选择不能为空",
            trigger: "change",
          },
        ],
      },
     //用户组编辑弹窗
     editUserGroupShow:false,
      // 更改密码
     passwordShow:false,
     passwordData:{
       field101:"",
       field102:"",
     },
      passwordDataRules: {
        field101: [
          {
            required: true,
            message: "不能为空",
            trigger: "change",
          },
        ],
        field102: [
          {
            required: true,
            message: "不能为空",
            trigger: "change",
          },
        ],
      },
      //邀请码
      Invitation: "",
      //修改模版名称弹窗
      editTemplateNameShow: false,
      //查看上级组件
      IdData: "",
      //公告弹窗
      uelLocation: "",
      //查看金额弹窗
      GetMoneyUps: false,
      roleList: [],
      GetMoneyData: {
        pageSize: 10,
        total: 0,
        pageNum: 1,
      },
      //判断佣金模板是修改还是新增
      judgeMoney: undefined,
      //卡片数据
      cardData: [
        {
          img: require("../../../assets/img/用户管理 - 间联.png"),
          num: 20,
          des: "团队总人数（个）",
          num1: "0",
          color: "#0d9d59",
        },
        {
          img: require("../../../assets/img/用户管理 - 间联 (1).png"),
          num: 15,
          des: "直联团队人数（个）",
          num1: "0",
          color: "#f9800b",
        },
        {
          img: require("../../../assets/img/用户管理 - 间联 (2).png"),
          num: 17,
          des: "间联团队人数（个）",
          num1: "0",
          color: "#3875f6",
        },
        {
          img: require("../../../assets/img/用户管理 - 间联 (3).png"),
          num: 12,
          des: "总余额（元）",
          num1: "0",
          color: "#fd2f37",
        },
      ],
      cardData2: [
        {
          img: require("../../../assets/card/1@2x.png"),
          img2: require("../../../assets/card/形状 44@2x.png"),
          num: 20,
          des: "团队总人数（个）",
          num1: "0",
          color:"rgba(254, 47, 55, 1)",
          bgcolor: "rgba(239, 235, 252, 1)",
        },
        {
          img: require("../../../assets/card/2@2x.png"),
          img2: require("../../../assets/card/形状 44@2x.png"),
          num: 15,
          des: "直联团队人数（个）",
          num1: "0",
          color:"rgba(254, 47, 55, 1)",
          bgcolor: "rgba(225, 249, 242, 1)",
        },
        {
          img: require("../../../assets/card/3@2x.png"),
          img2: require("../../../assets/card/形状 45@2x.png"),
          num: 17,
          des: "间联团队人数（个）",
          num1: "0",
          color:"rgba(27, 175, 105, 1)",
          bgcolor: "rgba(255, 249, 241, 1)",
        },
        {
          img: require("../../../assets/card/4@2x.png"),
          img2: require("../../../assets/card/形状 45@2x.png"),
          num: 12,
          des: "总余额（元）",
          num1: "0",
          color:"rgba(27, 175, 105, 1)",
          bgcolor: "rgba(255, 245, 244, 1)",
        },
      ],
      //直联编辑里面的佣金模板下拉
      commissionOptions: [],
      // 用户组下拉框
      userGroupList: [],
      //搜索的状态
      field105Options: [
        { value: undefined, label: "全部" },
        { value: 0, label: "正常" },
        { value: 1, label: "停用" },
        { value: 2, label: "禁用" },
      ],
      // 实名认证 0 选择实名 1 必须实名
      realNameAuth: null,
      //  状态
      field101Optionsstate: [
        {
          label: "停用",
          value: 1,
        },
        {
          label: "正常",
          value: 0,
        },
        {
          label: "禁用",
          value: 2,
        },
      ],
      rules4: {
        phone: [
          {
            pattern:
              /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
            message: "格式错误",
            trigger: "change",
          },
        ],
      },
      //查看上级数据参数
      CheckSuperiorData: [
        // {userName:"111",phoneNumber:"15555555555"},
      ],
      // 查看上级数据显示的最后一位
      CheckSuperiorNumber: "",
      // 用户组下拉
      field101Options: [
        // {
        //   label: "1",
        //   value: 1,
        // }
      ],
      total: 0,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        // 收入类型
        amountType: "1",
        // 时间
        dateRange: "",
      },
      // 导出遮罩层
      exportLoading: false,
      // 间联查看上级弹窗
      SuperiorShow: false,
      // 间联修改弹窗
      IndirectShow: false,
      // 充值和扣款弹窗
      moneyShow: false,
      moneyData: {
        field101: "3",
        field102: "",
        field103: "",
        field104: "",
        field105: "",
      },
      moneyrules: {
        field101: [
          {
            required: true,
            message: "选择不能为空",
            trigger: "change",
          },
        ],
        field102: [],
        field103: [
          {
            required: true,
            message: "请输入金额",
            trigger: "blur",
          },
          {
            pattern:
              /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
            message: "金额格式错误",
            trigger: "change",
          },
          // { type: 'number', message: '必须为数字值'}
        ],
        field104: null,
      },
      editTemplateNameRules: {
        field110: [
          {
            required: true,
            message: "选择不能为空",
            trigger: "change",
          },
        ],
      },
      field102Options: [
        {
          label: "充值",
          value: 3,
        },
        {
          label: "扣款",
          value: 2,
        },
      ],
      // 实名弹窗
      tanShow1: false,
      formData5: {
        field101: undefined,
        field102: undefined,
        field103: "",
      },
      rules5: {
        field101: [
          {
            required: true,
            message: "请输入真实姓名",
            trigger: "change",
          },
        ],
        field102: [
          {
            required: true,
            message: "请输入身份证号",
            trigger: "change",
          },
          {
            pattern:
              /^([1-6][1-9]|50)\d{4}(18|19|20)\d{2}((0[1-9])|10|11|12)(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/,
            message: "格式错误",
            trigger: "change",
          },
          //   {
          //   pattern: /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/,
          //   message: '格式错误',
          //   trigger: 'change'
          // }
        ],
      },

      inheritAttrs: false,
      // ..间联修改按钮参数
      formData: {
        field101: "",
        field102: "",
        field103: "",
        field104: "",
        field105: "",
        field106: 0,
        field107: "",
        field108: "",
        field109: "",
        field1010: "",
      },
      // 直联编辑弹窗参数
      DirectEditing: {
        field101: "",
        field102: "",
        field103: "",
        field104: "",
        field105: "",
        field106: 0,
        field107: "",
        field108: "",
        field109: "",
        field1010: "",
        field1011: "",
        field112: "",
        field110: "",
      },
      rules: {
        field101: [],
        field102: [],
        mobile: [
          {
            pattern: /^1(3|4|5|7|8|9)\d{9}$/,
            message: "手机号格式错误",
            trigger: "blur",
          },
        ],
        field103: [],
        field104: [],
        field105: [],
        field106: [],
        field107: [],
        field108: [],
      },
      field106Options: [
        {
          label: "停用",
          value: 1,
        },
        {
          label: "禁用",
          value: 2,
        },
        {
          label: "正常",
          value: 0,
        },
      ],
      field107Options: [
        {
          label: "选项一",
          value: 1,
        },
        {
          label: "选项二",
          value: 2,
        },
      ],
      field108Options: [
        {
          label: "选项一",
          value: 1,
        },
        {
          label: "选项二",
          value: 2,
        },
      ],
        //新增用户按钮是否禁用
        addButtonShow:false,
        postUserid: "",

      // 充值页面数据
      formTan: {
        name: 100,
        amount: 0,
        id: 0,
        mark: "",
      },
      showTanChongZhi: false,
      showTanKouKuan: false,
      value: false,
      // tap切换状态
      showTop: 0, //0:直联  1:间联
      // 新增模板弹窗显示状态
      showTan1: false,
      // 更换模板弹窗显示状态
      showTan2: false,
      // 查看上级弹窗显示状态
      showTan3: false,
      // 速率模板弹窗显示状态
      showTan4: false,
      // 身份管理弹窗显示状态
      showTan5: false,
      // 搜索的输入框条件
      userdata: {
        // 用户昵称
        createBy: undefined,
        // 用户姓名
        userName: undefined,
        // 手机号
        phonenumber: undefined,
        //状态
        stateUser: undefined,
        //用户组
        ugName: undefined,
        //用户账号
        userAccount: undefined,
      },

      // 团队数量添加状态
      teamFalg: true,
      inteamFalg: true,

      // 管理的单选选中状态
      radio: 0,
      // 分页器
      currentPage: 1,
      // form表单
      form: {},
      // 直联表格数据
      tableData1: [],
      // 间联表格数据
      tableData2: [],
      // 新增用户弹窗数据
      TanForm1: {
        userName: "",
        nickName: "",
        phonenumber: "",
        password: "",
        userGroup: "",
        remarks: "",
        roleIds: "",
        commission: "",
        stateUser: 0,
      },
      // 新增用户验证
      rulesTan1: {
        nickName: [
          { required: true, message: "请输入用户账号", trigger: "blur" },
        ],
        userName: [
          { required: true, message: "请输入用户昵称", trigger: "blur" },
        ],
        roleIds: [{ required: true, message: "请输入角色组", trigger: "blur" }],
        phonenumber: [
          { required: true, message: "请输入手机号", trigger: "blur" },
          {
            pattern: /^[1][3.4.5.7.8.9][0-9]{9}$/,
            message: "请输入正确的手机号!",
            trigger: "change",
          },
        ],
        password: [{ required: true, message: "请输入密码", trigger: "blur" }],
        commission: [
          { required: true, message: "请选择佣金模板", trigger: "blur" },
        ],
        userGroup: [
          { required: true, message: "请选择用户组", trigger: "blur" },
        ],
        stateUser: [{ required: true, message: "请选择状态", trigger: "blur" }],
      },

      // 直联编辑验证
      rulesTan5: {
        field1010: [
          { required: true, message: "请输入角色组", trigger: "blur" },
        ],
        field109: [
          { required: true, message: "请输入用户组", trigger: "blur" },
        ],

        field107: [
          { required: true, message: "请输入用户昵称", trigger: "blur" },
        ],
        field106: [
          { required: true, message: "请输入账号状态", trigger: "blur" },
        ],
        field105: [
          { required: true, message: "请输入联系方式", trigger: "blur" },
        ],
        field110: [
          { required: true, message: "请输入佣金模板", trigger: "change" },
        ],
      },
      //角色组
      RoleData: [],
      // 修改模板弹窗数据
      TanForm2: {
        data: "",
        type: "",
      },
      activeName: "0",
      // 身份管理弹窗数据
      TanForm5: {},
      chooseHYid: "",
      upmoney: 0,
      upuserId: "",
      getdata: "",
      valuehh: 0,
      templateId: "",
      mobanUser: "",
      userId: "",
      userCode: "", //获取是租户还是用户
      row: {
        userId: "",
      },
    };
  },
  components: { Dialog, ViewSuperior },
  computed() {},
  async created(){
      //   this.$nextTick(() => {
		  //       for (let i = 0; i < this.showcolumntable.length; i++) {
		  //        this.$refs.multipleTable.toggleRowSelection(this.showcolumntable[i])
      //       }
		  //  })
      //  this.$nextTick(() => {
		  //       for (let i = 0; i < this.jianliantable.length; i++) {
		  //        this.$refs.jianliantable.toggleRowSelection(this.jianliantable[i])
      //       }
		  //  })
          
  },
  // 生命周期函数
  async mounted() {
    console.log(this.cardData, "8888");
    //获取是租户还是用户
    const { data } = await getIdentityAndTopId();
    console.log(data, "用户信息平台还是租户");
    this.userCode = data.identity;
    //公告弹窗
    if (data.identity == "用户") {
      this.AddAnnouncement();
      this.checkedColumns = this.yzcheckedColumns
      this.checkBoxGroup = this.yzcheckBoxGroup
    }else{
      this.checkedColumns = this.zzcheckedColumns
      this.checkBoxGroup = this.zzcheckBoxGroup
    }
    console.log(this.userCode, "用户还是租户");
    const userID = sessionStorage.getItem("userID");
    this.userId = userID - 0;

    // 获取用户列表
    this.getData();
    //获取佣金模板下拉框
    this.commissionlist();
  },
  watch: {
       checkedColumns(val) {
        if(this.userCode == '用户'){
               if(this.showTop == 0){
                let arr = this.checkBoxGroup.filter(i => !val.includes(i));
                this.showcolumntable1.filter(i => {
                  if (arr.indexOf(i.name) != -1) {
                    i.show = false;
                  } else {
                    i.show = true;
                  }
                });
                this.reload = Math.random()
                }else{
                  let arr = this.checkBoxGroup.filter(i => !val.includes(i));
                  this.jianliantable1.filter(i => {
                  if (arr.indexOf(i.name) != -1) {
                    i.show = false;
                  } else {
                    i.show = true;
                  }
                });
                this.reload = Math.random()
            }
        }else{
              if(this.showTop == 0){
                let arr = this.checkBoxGroup.filter(i => !val.includes(i));
                this.showcolumntable.filter(i => {
                  if (arr.indexOf(i.name) != -1) {
                    i.show = false;
                  } else {
                    i.show = true;
                  }
                });
                this.reload = Math.random()
                }else{
                  let arr = this.checkBoxGroup.filter(i => !val.includes(i));
                  this.jianliantable.filter(i => {
                  if (arr.indexOf(i.name) != -1) {
                    i.show = false;
                  } else {
                    i.show = true;
                  }
                });
                this.reload = Math.random()
            }
        }
         
       }
     },
  methods: {
    //点击更改密码
    editPassword(row){
       console.log(row,'777777')
       this.passwordData={
       field101:"",
       field102:"",
       userName:row.userName
     };
      this.passwordShow=true;
    },
    //更改密码确定按钮
    editPasswordButton() {
      this.$refs["passwordDataElForm"].validate((valid) => {
        if (valid) {
          if (this.passwordData.field101!==this.passwordData.field102) {
            this.$message({
              message: "2次密码不一致",
              type: "warning",
            });
          } else {
            let param = {
              password: this.passwordData.field101, //新密码
              username: this.passwordData.userName, //用户账号
            };
            resetPassword(param).then((res) => {
              if (res.code == 200) {
                this.$message({
                  type: "success",
                  message: "操作成功！",
                });
                this.getData();
                this.passwordShow = false;
              } else {
                this.$message.error(res.msg);
              }
            });
          }
        }
        // this.close();
      });
    },
    async ttt() {
      let param = {
        phone: "17639181867",
        url: "Y76glH",
      };
      const data = await getAliDy(param);
      console.log(data, "888");
    },
    // 导出
    async handleAdd(row) {
      // 列表
      let param = {
        nickName: this.userdata.createBy, //用户姓名
        phoneNum: this.userdata.phonenumber, //手机号
        realName: this.userdata.userName, //用户昵称
        stateUser: this.userdata.stateUser, //状态
        ugId: this.userdata.ugName, //用户组
        userName: this.userdata.userAccount, //用户账号
        // userId: this.userId,
        pageNum: this.queryParams.pageNum,
        pageSize: this.queryParams.pageSize,
      };
      let res = null;
      if (row == "直联") {
        res = await exportStraightTeamUser(param);
      } else {
        res = await exportBetweenTeamUser(param);
      }
      var downloadUrl = window.URL.createObjectURL(res); //转换
      //添加一个a标签，利用a标签打开表格
      var anchor = document.createElement("a");
      anchor.href = downloadUrl;
      anchor.download = decodeURI(`${row}.xlsx`);
      anchor.click();
    },
    //新增团队
    addUserFuns(formName) {
    
      console.log(this.TanForm1, "新增确定按钮");
      this.$refs[formName].validate(async (valid) => {
        if (valid) {
          this.addButtonShow=true;
          if (this.userCode == "用户") {
            let param = {
              username: this.TanForm1.nickName, //登陆名称 //账号
              nickName: this.TanForm1.userName, //用户名称   租户名称
              phoneNumber: this.TanForm1.phonenumber, //手机号码
              invitationCode: this.Invitation, //邀请码
            };
            const addData = await userAdd(param);
            if ((addData.code = 200)) {
              this.$message({
                type: "success",
                message: "新增成功！",
              });
              this.showTan1 = false;
               this.addButtonShow=false;
              this.getData();
            } else {
              this.$message.error(addData.msg);
            }
            console.log(addData, "状态");
          } else {
            
            let param = {
              sysUser: {
                userName: this.TanForm1.nickName, //登陆名称 //账号
                nickName: this.TanForm1.userName, //用户名称   租户名称
                phonenumber: this.TanForm1.phonenumber, //手机号码
                password: this.TanForm1.password, //密码
                roleIds: [this.TanForm1.roleIds], //角色组ID
                status: this.TanForm1.stateUser, //状态
                remark: this.TanForm1.remarks, //备注
              },
              ugId: this.TanForm1.userGroup, //用户组 传ID
            };
            console.log(this.TanForm1, "传递的参数");
            addUser(param).then((res) => {
              console.log(res, "结果5555555555555");
              if ((res.code = 200)) {
                this.$message({
                  type: "success",
                  message: "新增成功！",
                });
                this.showTan1 = false;
                  this.addButtonShow=false;
                this.getData();
              } else {
                this.$message.error("新增失败！");
              }
            });
          }
        } else {
          return false;
        }
      });
          setTimeout(()=>{
        this.addButtonShow=false;
      },1000);
      //   this.showTan1 = false;
    },
    //编辑模版名称确定按钮
    async EditTemplateNamebutton(formName) {
      this.$refs[formName].validate(async (valid) => {
        if (valid) {
          let paramData = {};

          if (this.judgeMoney) {
            paramData = {
              templateId: this.DirectEditing.field110, //佣金模板的id
              id: this.judgeMoney.id,
              userId: this.DirectEditing.field1010, //这一列的用用户组id
            };
            //修改佣金模板
            modifyMoney(paramData).then((res) => {
              console.log(res, "修改");
              if (res.code == 200) {
                this.$message({
                  message: "操作成功!",
                  type: "success",
                });
                this.getData();
                this.editTemplateNameShow = false;
              } else {
                this.$message.error(res.msg);
              }
            });
          } else {
            paramData = {
              templateId: this.DirectEditing.field110, //佣金模板的id
              userId: this.DirectEditing.field1010, //这一列的用用户组id
            };
            // 新增佣金模板
            addMoney(paramData).then((res) => {
              console.log(res, "结果66655555");
              if (res.code == 200) {
                this.$message({
                  message: "操作成功!",
                  type: "success",
                });
                this.getData();
                this.editTemplateNameShow = false;
              } else {
                this.$message.error(res.msg);
              }
            });
          }
        }
      });
    },
    //修改模版名称弹窗
    editTemplateNameBotton(row) {
      console.log(row, "00000000000");
      this.DirectEditing.field1010 = row.userId; //用户ID
      //回显佣金模板数据
      getMoney(row.userId).then((res) => {
        if (res.code == 200) {
          if (res.data) {
            this.judgeMoney = res.data;
            this.DirectEditing.field110 = res.data.templateId;
          } else {
            this.judgeMoney = null;
          }
        }

        console.log(res, "回显佣金模板");
      });

      this.editTemplateNameShow = true;
    },
    //修改用户组弹窗
    editUserGroupBotton(row) {
      console.log(row, "00000000000");
      this.userGroupData.field101=row.ugId;
      this.userGroupData.id = row.userId; //用户ID
      this.editUserGroupShow = true;
    },
       //编辑用户组
    async EditUserGroupbutton(formName) {
      this.$refs[formName].validate(async (valid) => {
        if (valid) {
            let parpam = {
              user: {
                userId: this.userGroupData.id, //用户id
              },
              userGroupRela: {
                ugId: this.userGroupData.field101, 
                uId: this.userGroupData.id, //用户组
              },
            };
            console.log(this.DirectEditing, "编辑确定");
            const { code } = await updateUserAPI(parpam);
            if (code == 200) {
              this.$message({
                message: "编辑成功",
                type: "success",
              });
              this.editUserGroupShow = false;
              this.getData();
            } else {
              this.$message.error("编辑失败");
            }
        } else {
          return false;
        }
      });
    },
    // 点击查看上级按钮
    async CheckSuperior(row) {
      this.IdData = row.userId;
      this.$refs.superior.gitData();
    },

    // 充值和扣款弹窗确定
    moneyShowButton() {
      this.$refs["elForm"].validate(async (valid) => {
        if (valid) {
          var reg =
            /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/;
          if (!reg.test(this.moneyData.field103)) {
            this.$message({
              message: "请输入正确的金额,最多保留2位小数",
              type: "warning",
            });
          } else {
            console.log(this.moneyData, "扣款参数");
            let param = {
              amount: this.moneyData.field103, //操作的金额
              userId: this.moneyData.field105,
              notes: this.moneyData.field104, //备注
              capitalType: "OTHER",
            };
            console.log(param, "22222");
            //3充值  2扣款
            if (this.moneyData.field101 == 3) {
              const addData = await addUserWallet(param);
              if (addData.code == 200) {
                this.$message({
                  message: "操作成功",
                  type: "success",
                });
                this.moneyShow = false;

                this.getData();
              } else {
                this.$message.error("操作失败");
              }
            } else {
              const creduceData = await reduceUserWallet(param);
              if (creduceData.code == 200) {
                this.$message({
                  message: "操作成功",
                  type: "success",
                });
                this.moneyShow = false;

                this.getData();
              } else {
                this.$message.error("操作失败");
              }
            }

            console.log(data, "回调参数");
            this.moneyData.field103 = "";
          }
        }
      });
    },
    async getData() {
      //获取本地的基础设置参数
      const setupParam = JSON.parse(sessionStorage.getItem("setupParam"));
      console.log(setupParam, "设置参数12");
      this.realNameAuth = setupParam.realNameAuth; //实名认证 0 选择实名 1 必须实名

      let listRoleData = {
        pageNum: 1,
        pageSize: 1000,
      };

      if (this.userCode != "用户") {
        listRole(listRoleData).then((res) => {
          console.log(res, "角色组");
          this.RoleData = res.rows;
          this.TanForm1.roleIds = res.rows[0].roleId;
        });
      }
      //获取用户组
      selectByUserGroupList().then((res) => {
        console.log(res, "用户组下拉");
          //编辑用户组下拉框
          this.editUserGroupData=res.data;
        const data = res.data.map((item) => {
          return {
            label: item.ugName,
            value: item.ugId,
          };
        });
        data.push({ value: undefined, label: "全部" });
        this.userGroupList = data;

        this.field101Options = data;
        this.TanForm1.userGroup = data[0].value;
      });

      // 卡片
      // const { data } = await selectByTeamSum({ userId: this.userId });
      const { data } = await selectByTeamSum();
      console.log(data, "卡片");
      this.cardData[0].num1 = data.teamSum;
      this.cardData[1].num1 = data.StraightTeam;
      this.cardData[2].num1 = data.BetweenTeam;
      this.cardData2[0].num1 = data.teamSum;
      this.cardData2[1].num1 = data.StraightTeam;
      this.cardData2[2].num1 = data.BetweenTeam;

      // {
      //   img: require('../../../assets/img/用户管理 - 间联.png'),
      //   num: 20,
      //   des: '团队总人数（个）',
      //   num1: '98765',
      //   color: '#0d9d59'
      // },

      // this.card.teamSum = data.teamSum;
      // this.card.StraightTeam = data.StraightTeam;
      // this.card.BetweenTeam = data.BetweenTeam;
      // this.card.totalMoney = data.totalMoney;
      //卡片里面的总余额

      if (this.userCode == "租户") {
        const totalMoney = await selectCapUserWalletList({
          tenantId: this.userId,
        });
        console.log(totalMoney, "卡片总余额222");
        if (totalMoney.code == 200) {
          this.cardData[3].num1 = totalMoney.data;
          this.cardData2[3].num1 = totalMoney.data;
        }
      } else {
        this.cardData[3].des = "团队总收入（元）";
        const data = await totalIncome({
          userId: this.userId,
          tenantId: sessionStorage.getItem("TenantId") - 0,
        });
        console.log(data, "团队总收入");
        if (data.code == 200) {
          this.cardData[3].num1 = data.data;
          this.cardData2[3].num1 = data.data;
        }
      }

      // 列表
      let param = {
        nickName: this.userdata.createBy, //用户姓名
        phoneNum: this.userdata.phonenumber, //手机号
        realName: this.userdata.userName, //用户昵称
        stateUser: this.userdata.stateUser, //状态
        ugId: this.userdata.ugName, //用户组
        userName: this.userdata.userAccount, //用户账号
        // userId: this.userId,
        pageNum: this.queryParams.pageNum,
        pageSize: this.queryParams.pageSize,
      };
      console.log(param, "传参的值");
      console.log(this.showTop, "传参的值4555");

      if (this.showTop == 0) {
        const { data } = await selectByTeamUser(param);
        // const { data } = await selectByTeamUser();
        data.list.forEach((item) => {
          // item.rmb=parseFloat(item.rmb);
          item.rmb = Number(item.rmb);
        });
        console.log(data, "直联列表");

        this.tableData1 = data.list;
        this.total = data.total;
      } else if (this.showTop == 1) {
        const { data } = await selectByBetweenTeamUser(param);
        console.log(data, "间连列表");
        this.tableData1 = data.list;
        this.total = data.total;
      }
    },
    //公告弹窗 //获取邀请码
    async AddAnnouncement() {
      //传递子组件当前的路由；然后调用子组件的事件函数showTop
      this.uelLocation = window.location.pathname.slice(1);
      this.$refs.mychild.gitData();
      //获取邀请码
      const yqm = await selectByInvitationCodeIsUserId();
      console.log(yqm, "邀请码");
      if (yqm.code == 200) {
        this.Invitation = yqm.msg;
      }
    },
    handleClick(tab) {
      console.log(tab, "切换");
      this.activeName = tab.name;
      this.showTop = tab.name - 0;
      this.getData();
      this.ifshowcolumn =false
      if(this.showTop == 0){
          if(this.userCode == "用户"){
            this.checkedColumns = this.yzcheckedColumns
            this.checkBoxGroup = this.yzcheckBoxGroup
          }else{
            this.checkedColumns = this.zzcheckedColumns
            this.checkBoxGroup = this.zzcheckBoxGroup
          }
      }else{
          if(this.userCode == "用户"){
            this.checkedColumns = this.yjcheckedColumns
            this.checkBoxGroup = this.yjcheckBoxGroup
          }else{
            this.checkedColumns = this.zjcheckedColumns
            this.checkBoxGroup = this.zjcheckBoxGroup
          }
      }

    },
 
    //直联编辑-佣金模板下拉框函数
    commissionChange() {
      // DirectEditing.field110
    },
    //重置按钮
    ResetButton(form) {
      // this.$refs[form].resetFields();
      (this.userdata = {
        // 用户昵称
        createBy: undefined,
        // 用户姓名
        userName: undefined,
        // 手机号
        phonenumber: undefined,
        //状态
        stateUser: undefined,
        //用户组
        ugName: undefined,
      }),
        // console.log(this.showTop,'6666')
        this.getData();
         this.$message({
          message: '搜索中...',
          type: 'success'
        });
    },
    //获取佣金模板下拉框
    async commissionlist() {
      //获取佣金模板下拉框
      const list = await getCommission({ createUserId: this.userId });
      console.log(list, "获取佣金模板");
      if (list.code == 200) {
        this.commissionOptions = list.data;
      }
    },

    //查看金额
    async seeMoney(row) {
      let param = {
        pageNum: this.GetMoneyData.pageNum,
        pageSize: this.GetMoneyData.pageSize,
        userId: row.userId,
      };
      const data = await selectCapUserWalletRecordList(param);
      console.log(data, "获取列表");
      if (data.code == 200) {
        data.data.list.forEach((item) => {
          item.amount = item.amount + "";
          // item.balance = item.balance + "";
          console.log(item.balance[0], "000");
        });
        data.data.list.forEach((item) => {
          if (item.amount[0] == "-") {
            item.amountType = "reduce";
          } else {
            item.amountType = "plus";
          }
          // if(item.balance[0]=='-'){
          //   item.balanceType='reduce'
          // }else{
          //    item.balanceType='plus'
          // };
        });
        this.roleList = data.data.list; //OTHER其它   PROFIT分润  COMMISSION佣金
        this.GetMoneyData.total = data.data.total;
        console.log(this.roleList, "获取列表222");
      } else {
        this.$message.error(data.msg);
      }
      this.row.userId = row.userId;
      // this.$router.push(`straightSeeMoney/${row.userId}`); //原来是跳转新页面，现在变成弹窗
      this.GetMoneyUps = true;
    },
    //查看金额列表函数
    async GetMoneyList() {
      let param = {
        pageNum: this.GetMoneyData.pageNum,
        pageSize: this.GetMoneyData.pageSize,
        userId: this.row.userId,
      };
      const data = await selectCapUserWalletRecordList(param);
      console.log(data, "获取列表");
      if (data.code == 200) {
        data.data.list.forEach((item) => {
          item.amount = item.amount + "";
          // item.balance = item.balance + "";
          //  console.log(item.balance[0], "000");
        });
        data.data.list.forEach((item) => {
          // console.log(item.balance.substring(0,1), "000");
          if (item.amount[0] == "-") {
            item.amountType = "reduce";
          } else {
            item.amountType = "plus";
          }
          // if(item.balance[0]=='-'){
          //   item.balanceType='reduce'
          // }else{
          //    item.balanceType='plus'
          // };
        });
        this.roleList = data.data.list; //OTHER其它   PROFIT分润  COMMISSION佣金
        this.GetMoneyData.total = data.data.total;
        console.log(this.roleList, "获取列表222");
      } else {
        this.$message.error(data.msg);
      }
    },

    // 账户余额操作
    moneyBotton(row) {
      console.log(row, "余额操作");
      this.moneyShow = true;
      this.moneyData.field102 = row.rmb;
      this.moneyData.field105 = row.userId;
    },

    // 直联编辑按钮
    async userGetFun(row) {
      this.DirectEditing.field110 = "";
      console.log(row, "编辑按钮");
      this.DirectEditing.field101 = row.date;
      this.DirectEditing.field102 = row.realName;
      this.DirectEditing.field103 = row.idCard;
      this.DirectEditing.field104 = row.rmb;
      this.DirectEditing.field105 = row.phoneNumber;
      this.DirectEditing.field106 = row.stateUser;
      this.DirectEditing.field107 = row.nickName;
      this.DirectEditing.field108 = row.password;
      this.DirectEditing.field1010 = row.userId; //用户ID
      this.DirectEditing.field1011 = row.roId; //角色组
      this.DirectEditing.field112 = row.remark; //角色组

      this.DirectEditing.field109 = row.ugId; //用户组ID
      this.DirectEditing.field113 = row.userName; //用户账号
      this.inheritAttrs = true;

      console.log(row.userId, "6666666666666");
      //回显佣金模板数据
      getMoney(row.userId).then((res) => {
        if (res.code == 200) {
          if (res.data) {
            this.judgeMoney = res.data;
            this.DirectEditing.field110 = res.data.templateId;
          } else {
            this.judgeMoney = null;
          }
        }

        console.log(res, "回显佣金模板");
      });
      // this.ifShowTan5(true);
    },
    // 间联编辑按钮
    InterEdit(row) {
      console.log(row, "间联编辑按钮");
      this.formData.field101 = row.date;
      this.formData.field102 = row.realName;
      this.formData.field103 = row.idCard;
      this.formData.field104 = row.rmb;
      this.formData.field105 = row.phoneNumber;
      this.formData.field106 = row.stateUser;
      this.formData.field107 = row.nickName;
      this.formData.field108 = row.password;
      this.formData.field1010 = row.userId; //用户ID
      this.formData.field113 = row.userName; //用户账号

      this.formData.field109 = row.ugId; //用户组ID
      this.IndirectShow = true;

      // this.ifShowTan5(true);
    },
    // 间联编辑确定按钮
    async InterEditButton(formName) {
      this.$refs[formName].validate(async (valid) => {
        if (valid) {
          var myreg = /^[1][3,4,5,7,8,9][0-9]{9}$/;
          if (!myreg.test(this.formData.field105)) {
            this.$message({
              message: "手机号格式不正确",
              type: "warning",
            });
          } else {
            let parpam = {
              user: {
                phonenumber: this.formData.field105, //手机号
                nickName: this.formData.field107, //用户昵称
                status: this.formData.field106, //账号状态
                userId: this.formData.field1010, //用户id
              },
              userGroupRela: {
                ugId: this.formData.field109, //用户组
                uId: this.formData.field1010, //用户id
              },
            };
            console.log(this.formData, "编辑确定");
            const { code } = await updateUserAPI(parpam);
            if (code == 200) {
              this.$message({
                message: "编辑成功",
                type: "success",
              });
              this.IndirectShow = false;
              this.getData();
            } else {
              this.$message.error("编辑失败");
            }
          }
        } else {
          return false;
        }
      });
    },
    // 实名按钮
    RealName(row) {
      console.log(row, "实名按钮");
      this.formData5.field103 = row.userId;
      this.formData5.field101 = row.realName;
      this.formData5.field102 = row.idCard;
      // idCard// 身份证号
      // realName// 姓名
      this.tanShow1 = true; //实名弹窗
    },
    // 实名弹窗函数
    handelConfirm5() {
      this.$refs["elForm"].validate((valid) => {
        if (valid) {
          // console.log(this.formData5.field102,'身份证')
          var reg =
            /^(([1][1-5])|([2][1-3])|([3][1-7])|([4][1-6])|([5][0-4])|([6][1-5])|([7][1])|([8][1-2]))\d{4}(([1][9]\d{2})|([2]\d{3}))(([0][1-9])|([1][0-2]))(([0][1-9])|([1-2][0-9])|([3][0-1]))\d{3}[0-9xX]$/;
          console.log(reg.test(this.formData5.field102), "身份证222");
          if (!reg.test(this.formData5.field102)) {
            this.$message({
              message: "请输入正确的身份证号",
              type: "warning",
            });
          } else {
            let param = {
              realname: this.formData5.field101, //真实姓名
              idCard: this.formData5.field102, //身份证号
              uId: this.formData5.field103, //id
            };
            console.log(this.formData5, "实名按钮");
            updateRUser(param).then((res) => {
              if (res.code == 200) {
                this.$message({
                  type: "success",
                  message: "实名成功！",
                });
                this.getData();
                this.tanShow1 = false;
              } else {
                this.$message.error("实名失败！");
              }
            });
          }
        }
        // this.close();
      });
    },
    // 新增用户弹窗
    ifShowTan1(flag) {
      this.showTan1 = flag;
      this.TanForm1.userName='';
      this.TanForm1.remarks='';
      this.TanForm1.phonenumber='';
      this.TanForm1.nickName='';
    },

    // 切换直联 间连
    showIf(num) {
      console.log(num, "切换");
      this.showTop = num;
      this.getData();
    },
    // 搜索
    search() {
      console.log(this.userdata, "搜索按钮");
      this.getData();
       this.$message({
          message: '搜索中...',
          type: 'success'
        });
    },

    //直联编辑确定按钮
    async Editbutton(formName) {
      this.$refs[formName].validate(async (valid) => {
        if (valid) {
          var myreg = /^[1][3,4,5,7,8,9][0-9]{9}$/;
          if (!myreg.test(this.DirectEditing.field105)) {
            this.$message({
              message: "手机号格式不正确",
              type: "warning",
            });
          } else {
            let parpam = {
              user: {
                phonenumber: this.DirectEditing.field105, //手机号
                nickName: this.DirectEditing.field107, //用户昵称
                status: this.DirectEditing.field106, //账号状态
                userId: this.DirectEditing.field1010, //用户id
                roleIds: [this.DirectEditing.field1011], //角色组
                remark: this.DirectEditing.field112, //备注
              },
              userGroupRela: {
                ugId: this.DirectEditing.field109, //用户组
                uId: this.DirectEditing.field1010, //
              },
            };
            console.log(this.DirectEditing, "编辑确定");
            const { code } = await updateUserAPI(parpam);
            if (code == 200) {
              this.$message({
                message: "编辑成功",
                type: "success",
              });
              this.inheritAttrs = false;
              this.getData();
            } else {
              this.$message.error("编辑失败");
            }
            let paramData = {};
            console.log(this.judgeMoney, "结果5555555555555");
            if (this.judgeMoney) {
              paramData = {
                templateId: this.DirectEditing.field110, //佣金模板的id
                id: this.judgeMoney.id,
                userId: this.DirectEditing.field1010, //这一列的用用户组id
              };
              //修改佣金模板
              modifyMoney(paramData).then((res) => {
                console.log(res, "修改");
              });
            } else {
              paramData = {
                templateId: this.DirectEditing.field110, //佣金模板的id
                userId: this.DirectEditing.field1010, //这一列的用用户组id
              };
              // 新增佣金模板
              addMoney(paramData).then((res) => {
                console.log(res, "结果66655555");
              });
            }
          }
        } else {
          return false;
        }
      });
    },
    /** 导出按钮操作 */
    handleExport() {
      const queryParams = this.queryParams;
      this.$confirm("是否确认导出所有角色数据项?", "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          return exportRole(queryParams);
        })
        .then((response) => {
          this.download(response.msg);
          this.exportLoading = false;
        })
        .catch(() => {});
    },

    // ..修改按钮函数
    // onOpen() {},
    onClose() {
      this.$refs["elForm"].resetFields();
    },
    close() {
      this.$emit("update:visible", false);
    },
    handelConfirm() {
      this.$refs["elForm"].validate((valid) => {
        if (!valid) return;
        this.close();
      });
    },

    // ..编辑按钮里面的保存
    save(formName) {
      console.log(formName, "333");
      this.$refs[formName].validate((valid) => {
        console.log(valid, "22");
        if (valid) {
          deptSave(this.editForm)
            .then((res) => {
              if (res.success) {
                this.getdata(this.formInline);
                this.$message({
                  type: "success",
                  message: "公司保存成功！",
                });
              } else {
                this.$message({
                  type: "info",
                  message: res.msg,
                });
              }
            })
            .catch((err) => {
              this.$message.error("公司保存失败，请稍后再试！");
            });
        } else {
          return false;
        }
      });
    },
    //..显示编辑界面
    handleEdit: function (index, row) {
      console.log(row, "点击编辑按钮");
      if (row != undefined && row != "undefined") {
        this.title = "修改";
        this.editForm.deptId = row.deptId;
        this.editForm.deptName = row.deptName;
        this.editForm.deptNo = row.deptNo;
      } else {
        this.title = "添加";
        this.editForm.deptId = "";
        this.editForm.deptName = "";
        this.editForm.deptNo = "";
      }
    },

    //查询用户对应佣金模板
    selectListtmb() {
      let data = {
        userId: this.mobanUser,
      };
      selectListtmb(data).then((data) => {
        if (data.code == 200) {
          console.log(data);
          if (data.data.length > 0) {
            this.templateId = data.data[0].templateId;
          }
        }
      });
    },
    //查询模板
    selectList(data) {
      selectList(data).then((data) => {
        if (data.code == 200) {
          console.log(data);
        }
      });
    },
    //绑定会员和佣金模板
    onSelectedDrug() {
      console.log(this.templateId);
      let data = {
        templateId: this.templateId,
        userId: this.mobanUser,
      };
      insertmb(data).then((data) => {
        if (data.code == 200) {
        }
      });
    },
    //检查手机号
    isCellPhone(val) {
      if (!/^1(3|4|5|6|7|8)\d{9}$/.test(val)) {
        return false;
      } else {
        return true;
      }
    },
    //加入会员组
    handchange() {
      console.log(this.valuehh, "开关", "1", this.upuserId);
      let data = {
        type: this.valuehh,
        userId: this.upuserId,
      };
      updateHHRRole(data).then((res) => {
        console.log(res, "返回的数据");
        // if(data.code==200){
        //    console.log(data,'返回的数据')
        //    this.$message({
        //                type: 'success',
        //                message: '修改成功!'
        //              });
        //    this.ifShowTan5(false);
        // }
      });
    },
    //修改团队的方法
    upHYclick() {
      let data = {
        groupId: this.chooseHYid,
        userId: this.upuserId,
      };
      this.updateSysUserGroupByInfo(data);
    },
    //修改用戶組
    updateSysUserGroupByInfo(data) {
      updateSysUserGroupByInfo(data).then((data) => {
        if (data.code == 200) {
          console.log(data);
          this.ifShowTan5(false);
        }
      });
    },
    //获取下拉框 selectUserIdByCelueInfo
    selectUserIdByCelueInfo() {
      selectUserIdByCelueInfo().then((data) => {
        if (data.code == 200) {
          console.log(data);
        }
      });
    },
    //更改账户状态
    updateUserStatu(a, id) {
      this.$confirm("此操作将更改用户状态, 是否继续?", "", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          if (a == 0) {
            a = 1;
          } else {
            a = 0;
          }
          let data = {
            status: a,
            userId: id,
          };
          updateUserStatu(data).then((data) => {
            console.log(data);
            if (data.code == 200) {
              this.$message({
                type: "success",
                message: "修改成功!",
              });
              this.getUserIdFun();
            }
          });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消",
          });
        });
    },
    // 充值
    czAmount() {
      let data = {
        amount: this.formTan.amount,
        type: 0,
        userId: this.formTan.id,
      };
      addCapUserWalletCommissionsAmount(data).then((data) => {
        console.log(data);
        if (data.code == 200) {
          this.$message({
            type: "success",
            message: "充值成功",
          });
          this.$refs["formTan"].resetFields();
          this.showTanChongZhi = false;
          this.getUserIdFun();
          selectByParentUserCount().then((data) => {
            this.getdata = data;
          });
        }
      });
    },
    //扣款
    zhRmove() {
      let data = {
        amount: this.formTan.amount,
        type: 1,
        userId: this.formTan.id,
      };
      addCapUserWalletCommissionsAmount(data).then((data) => {
        console.log(data);
        if (data.code == 200) {
          this.$message({
            type: "success",
            message: "扣款成功",
          });
          this.$refs["formTan"].resetFields();
          this.showTanKouKuan = false;
          this.getUserIdFun();
        }
      });
    },
    ifShowTanKouKuan(flag, a) {
      this.showTanKouKuan = flag;
      this.formTan.name = a.amount * 1;
      this.formTan.id = a.userId;
    },

    // 管理菜单的选中函数
    handleCommand(command) {
      this.radio = command;
    },
    // 分页器
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
    },

    // 控制修改模板弹窗
    ifShowTan2(flag, data) {
      if (flag) {
        this.TanForm2.data = data.templateName;
        // this.TanForm2.type = data
      } else {
        // this.TanForm2.type.templateName = this.TanForm2.data
      }
      this.showTan2 = flag;
    },
    // 控制查看上级弹窗
    ifShowTan3(flag) {
      this.showTan3 = flag;
    },
    // 控制速率模板弹窗
    ifShowTan4(flag) {
      this.showTan4 = flag;
    },
    // 控制身份管理弹窗
    ifShowTan5(flag) {
      this.showTan5 = flag;
    },
    //获取间联用户组

    // 获取用户列表函数
    getUserListFun(userdata) {
      let userDataList = {
        ...userdata,
        parentUserId: this.parentUserId,
      };
      // 直联发送请求
      userSelectByParentUserInfo(userDataList).then((data) => {
        console.log(data);
        if (data.code == 200) {
          // 添加直联返回数据
          this.tableData1 = data.rows;
          // 判断显示直联的总余额
        } else {
          this.$message.error(data.msg);
        }
      });
      // // 间联发送请求
      // selectBySonUserInfo().then((data) => {
      //   if (data.code == 200) {
      //     // 添加间联返回数据
      //     this.tableData2 = data.data.rows;
      //     // 判断显示间联的总余额
      //   } else {
      //     this.$message.error(data.msg);
      //   }
      // });
    },

    // 重置
    reset() {
      this.userdata.createBy =
        this.userdata.userName =
        this.userdata.phonenumber =
          undefined;
      this.getUserListFun();
    },

    // 修改用户
    userPutFun() {
      userPut().then((data) => {
        console.log(11);
        console.log(data);
      });
    },
    //查询用户和用户组已绑定的关系
    selectSysUserGroupBD(id) {
      console.log(id);
      this.mobanUser = id;
      let data = {
        userId: id,
      };
      selectSysUserGroupBD(data).then((data) => {
        if (data.code == 200) {
          this.chooseHYid = data.data;
          console.log(typeof this.chooseHYid);
        }
      });
    },

    // 导出用户数据
    userExportFun() {
      userExport({ phonenumber: "15888888881" }).then((data) => {
        console.log(data);
      });
    },
    // 会员组点击
    clickVip(data) {
      console.log(data);
      this.postUserid = data.userId;
      // this.$router.push({ path: "/platform/user1", query: { user: data } });
      this.showTan4 = true;
    },
    // 获取当前登录用户id
    getUserIdFun() {
      getUserId().then((data) => {
        this.parentUserId = data.data;
        this.getUserListFun();
      });
    },
  },
};
</script>
<style scoped>
.box-card-top{    display: flex;
                  flex-direction: row;
				          align-items: center;
				          border-radius:20px 20px 0 0 ;
                  /* justify-content: center; */
				          height:170px;
							    background-color: var(--color);
}
/* 编辑表单文字的样式 */
::v-deep .jsName .el-form-item__label{
  color: #999;
}
::v-deep .el-tabs__header {
  margin: 0px;
}
/* 弹窗居中 */
::v-deep .el-dialog__wrapper {
   display: flex;
   justify-content: center;
   align-items: center;
}
::v-deep .el-dialog:not(.is-fullscreen) {
  margin-top: 0vh !important;
}
.xhxBox {
  height: 5px;
  border-top: 1px #eee solid;
  margin: 10px 0px 20px 0px;
}
</style>
<style>
.showcolumntable{
  position: absolute;
  right: 5%;
  top: 45%;
  z-index: 99;
}

.user .el-tabs__nav-wrap::after {
  height: 0;
}

.user .el-tabs__active-bar {
  width: 0px !important;
}

.user .el-divider--horizontal {
  background: #eee;
  margin-top: 0;
}

/*.user .el-card__body {*/
/*  padding: 0;*/
/*}*/
</style>
